<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <canvas style="border:1px solid #ffdee9;" width="600" height="400" ></canvas>
</body>
<script>
    // 获取画布
    let canvas=document.querySelector("canvas")
    // 获取一支笔
    let ctx=canvas.getContext("2d") 
    ctx.moveTo(100,100)
    ctx.lineTo(200,200)
    ctx.lineTo(300,100)
    ctx.lineTo(100,100)

    // 填充
    ctx.fillStyle="#fbdee9"
    ctx.fill()
    


</script>
</html>